/*
 *	Copyright 2011 andro-inject developers 
 *	Licensed under the Apache License, Version 2.0 (the "License"); 
 *	you may not use this file except in compliance with the License. 
 *	You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 * 
 *	Unless required by applicable law or agreed to in writing, software 
 *	distributed under the License is distributed on an "AS IS" BASIS,
 *	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	See the License for the specific language governing permissions and
 *	limitations under the License. 
 * 
*/

package com.androinject.core.factory;

import com.androinject.core.definitions.ComponentDefinition;
import com.androinject.core.definitions.ManagedComponentDefinition;

/**
 * The ComponentProcessor interface can be used if a component requires some extra processing after its creation.
 * Component processors can be added to ComponentFactory implementations that support the ComponentProcessor interface
 * (like DefaultXmlComponentFactory or AndroidXmlComponentFactory).
 * ComponentProcessor implementations have to provide four methods that are automatically called after the component processor
 * has been added to a component factory. 
 */
public interface ComponentProcessor {
	
	/**
	 * Is called directly after a new component has been created. No dependencies have been injected in this moment.
	 * @param component the newly created component
	 * @param definition the component definition
	 */
	public void beforeComponentInjection(Object component, ComponentDefinition definition);
	
	/**
	 * Is called after a new component has been created and all dependencies have been injected.
	 * @param component the newly created component
	 * @param definition the component definition
	 */
	public void afterComponentInjection(Object component, ComponentDefinition definition);
	
	/**
	 * Is called before dependencies are injected into a managed component.
	 * @param component the managed component
	 * @param definition the managed component definition
	 */
	public void beforeManagedComponentInjection(Object component, ManagedComponentDefinition definition);
	
	/**
	 * Is called after all dependencies have been injected into a managed component
	 * @param component the managed component
	 * @param definition the managed component definition
	 */
	public void afterManagedComponentInjection(Object component, ManagedComponentDefinition definition);
	
}
